SmartFTP FTP Library
IAsyncSSLSocketLayer::RemoteCert Property

Contains a the encoded remote certificate

C++
_variant_t varRemoteCert = pConnection->TLS->RemoteCert;
// TODO: Get the data out of the variant (SAFEARRAY, VT_UI1 | VT_ARRAY)
byte *pbData = NULL;
DWORD cbData = 0;
// Create a certificate context
PCCERT_CONTEXT pCertContext = reinterpret_cast<PCCERT_CONTEXT>(::CertCreateContext(CERT_STORE_CERTIFICATE_CONTEXT, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, pbData, cbData, 0, NULL));
if (pCertContext)
{
   // TODO: Do something with the cert. e.g. display cert dialog
   ::CertFreeCertificateContext(pCertContext);
IDL
__property VARIANT* RemoteCert;
What do you think about this topic? Send feedback!
Copyright (c) by SmartSoft Ltd. All rights reserved.